'use strict';
var even_group_calculate_average = function(collection){
  var ave = []
  var sum = [0,0,0]
  var count = [0,0,0]
  for (let i = 0; i < collection.length; i++) {
    if((i+1)%2==0&&collection[i]%2==0){
      if(collection[i]<10){
        sum[0]+=collection[i];
        count[0]++;
      }
      if(9<collection[i]&&collection[i]<100){
        sum[1]+=collection[i];
        count[1]++;
      }
      if(99<collection[i]&&collection[i]<1000){
        sum[2]+=collection[i];
        count[2]++;
      }
    }
  }
  if(count[1]!=[]&&count[2]!=0&&count[0]!=[]){
    for (let i = 0; i < 3; i++) {
      ave.push(sum[i]/count[i])
    }
  }
  if(count[1]==[]&&count[2]==0&&count[0]==[]){
    ave.push(0)
  }
  if(count[1]==[]&&count[2]!=0&&count[0]==[]){
    ave.push(sum[2]/count[2])
  }
  return ave;
};
module.exports = even_group_calculate_average;
